package itheima.d03;

import java.math.BigDecimal;

public class Test {
    public static void main(String[] args) {
        System.out.println(0.25 + 0.1);
        System.out.println(1.0-0.32);
        System.out.println(1.015*100);
        System.out.println(1.301/100);

        System.out.println(BigDecimal.valueOf(0.25).add(BigDecimal.valueOf(0.1)));
        System.out.println(BigDecimal.valueOf(1.0).subtract(BigDecimal.valueOf(0.32)));
        System.out.println(BigDecimal.valueOf(1.301).divide(BigDecimal.valueOf(100)));
        System.out.println(BigDecimal.valueOf(1.301).multiply(BigDecimal.valueOf(100)));

        BigDecimal bd1 = new BigDecimal("0.1");

        BigDecimal bd2 = new BigDecimal("0.2");
        BigDecimal addResult = bd1.add(bd2);
        double addNumResult = addResult.doubleValue();
        System.out.println(addNumResult);
        System.out.println(addResult);

        System.out.println("=============================");

        BigDecimal bd3=BigDecimal.valueOf(0.1);
        BigDecimal bd4=BigDecimal.valueOf(0.2);
        BigDecimal addResult2 = bd3.add(bd4);
        double addNumResult2 = addResult2.doubleValue();


        System.out.println(BigDecimal.valueOf(1.015).multiply(BigDecimal.valueOf(100)));
        System.out.println(BigDecimal.valueOf(1.301).subtract(BigDecimal.valueOf(0.32)));
        System.out.println(BigDecimal.valueOf(1.301).divide(BigDecimal.valueOf(100)));
        System.out.println("===================================");
        BigDecimal result = BigDecimal.valueOf(0.1).divide(BigDecimal.valueOf(0.3),5,BigDecimal.ROUND_HALF_UP);
        System.out.println(result);

    }



    }

